package com.ioog.domain.model;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Embeddable;

@Embeddable
public class Image implements Serializable {
	
	private static final long serialVersionUID = 5000266340455573319L;

	@Column(name="img_name", nullable=false)
	private String name;
	
	@Column(name="img_url", nullable=false)
	private String url;
	
	@Column(name="img_width")
	private int width;
	
	@Column(name="img_height")
	private int height;

	public Image() { }
	
	public Image(String name, String url) {
		super();
		this.name = name;
		this.url = url;
	}

	public Image(String name, String url, int width, int height) {
		super();
		this.name = name;
		this.url = url;
		this.width = width;
		this.height = height;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public int getWidth() {
		return width;
	}

	public void setWidth(int width) {
		this.width = width;
	}

	public int getHeight() {
		return height;
	}

	public void setHeight(int height) {
		this.height = height;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((url == null) ? 0 : url.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Image other = (Image) obj;
		if (url == null) {
			if (other.url != null)
				return false;
		} else if (!url.equals(other.url))
			return false;
		return true;
	}
	
	
	
	
	
}
